<%@ page import="com.zhiyou.entity.Column" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="com.zhiyou.entity.News" %>
<%@ page import="com.zhiyou.util.NewsUtil" %><%--
  Created by IntelliJ IDEA.
  User: 磊布斯
  Date: 2021/9/15
  Time: 22:39
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">

    <!-- 可选的 Bootstrap 主题文件（一般不用引入） -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap-theme.min.css" integrity="sha384-6pzBo3FDv/PJ8r2KRkGHifhEocL+1X2rVCTTkUfGk7/0pbek5mMa1upzvWbrUbOZ" crossorigin="anonymous">

    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>
</head>
<body>
<%--获取栏目--%>
<%
    ArrayList<Column> columnList = (ArrayList<Column>) session.getAttribute("columnList");
    ArrayList<News> newsList = (ArrayList<News>) session.getAttribute("newsList");
%>
<!-- 新闻管理 -->
<div class="AccountManagement_c" id="NewsManagement_c">
    <h3>天下事
        <form action="../DoGetNews" method="post">
            <div class="amcl fr">
                <select class="fl NewsManagement_search" name="selectCid">

                    <%
                        for (int i = 0; i < columnList.size() ; i++) {
                    %>
                    <%--获取选中的cid--%>
                    <option value="<%=columnList.get(i).getCid()%>"><%=columnList.get(i).getName()%></option>
                    <%
                        }
                    %>
                </select>
                <button class="b80">查看新闻</button>
            </div>
        </form>

    </h3>
    <div>
        <table class="table">
            <thead>
            <td>标题</td>
            <td>内容</td>
            </thead>
            <tbody>
            <%
                if (newsList!=null){
                for (int i = 0; i < newsList.size() ; i++) {
              %>
            <tr>
                <td><%=newsList.get(i).getTitle()%></td>
                <td><%=newsList.get(i).getDetail()%></td>
            </tr>
            <%
                }
                }
            %>
            </tbody>
        </table>
    </div>
</div>
</body>
</html>
